package com.olmarket.core.api;

/**
 * @author: qwesde@hust.edu.cn
 * @date: 2021/2/15 12:51
 */
public enum ResultCode implements IErrorCode {

    // 1,000 通用错误
    SUCCESS(200, "Okay"),
    VALIDATE_FAILED(404, "参数检验失败"),
    UNAUTHORIZED(401, "暂未登录或token已经过期"),
    FORBIDDEN(403, "没有相关权限"),
    FAILED(500, "Error"),
    PARAMETER_VALIDATION_ERROR(1001, "参数不合法"),
    UNKNOWN_ERROR(1002, "未知错误"),


    // 2,000 开头的是user的错误信息
    USER_NOT_EXIST(2001, "用户不存在");

    private ResultCode(long code, String msg) {
        this.code = code;
        this.msg = msg;

    }

    private long code;
    private String msg;

    @Override
    public long getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }
}
